/*
 * UIComposite.h
 */

#ifndef UICOMPOSITE_H_
#define UICOMPOSITE_H_

#include "UIComponent.h"

#include <list>

/**
 * Abstract class representing an UI Component
 * which can be composed of other UI Components
 */
class UIComposite: public UIComponent {
public:
  /**
   * Type of UI Composite Component
   */
  enum CompositeType {
    TOPCONTAINER, STDCONTAINER
  };

  /**
   * Draws all the childish UI Components
   */
  virtual void draw();

  /**
   * Returns the type UI Composite Component
   */
  UIComposite::CompositeType getType();

  /**
   * Adds an UI Component as a child
   * @param uic the UI Component to be added
   */
  void add(UIComponent* uic);

  /**
   * Removes a childish UI Component
   * @param uic the UI Component to be removed
   */
  void remove(UIComponent* uic);

  /**
   * Supplies the list of all the childish UI Components
   */
  std::list<UIComponent*>& getChildren();

  /**
   * Set the dimensions of the UI Composite Component
   * @param width width of the UI Component
   * @param height height of the UI Component
   */
  void setDimensions(float width, float height);

  /**
   * Set the border size of the UI Composite Component
   * @param borderSize the border size to be applied
   */
  void setBorderSize(float borderSize);

  /**
   * Set the border size of the UI Composite Component
   * @param rounding rounding level to be applied to the corners
   */
  void setRoundingCorner(float rounding);

  /**
   * Set the background and border colors
   * @param background color to be use when rendering the background
   * @param border color to be use when rendering borders
   */
  void setColors(RGBAColor& background, RGBAColor& border);

protected:
  /**
   * Mode of the UI Composite Component
   */
  CompositeType _mode;

  /**
   * The list of all the childish UI Components
   */
  std::list<UIComponent*> _children;

  /**
   * Size of the border of the UI Composite Component
   */
  float _borderSize;

  /**
   * Percentage of rounding corners of the UI Composite Component
   * (no effect yet)
   */
  float _roundingCorner;

  /**
   * Default color for painting background
   */
  RGBAColor _colorBackground;

  /**
   * Default color for painting borders
   */
  RGBAColor _colorBorder;
};

#endif /* UICOMPOSITE_H_ */
